package com.httpClient.chapter2;

import com.httpClient.chapter1.UrlEncodeFormHttpClient;
import com.httpClient.util.ResponseUtil;
import com.sky.JULLog.MyJulLogger;
import org.apache.http.*;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicHeaderElementIterator;
import org.apache.http.message.BasicNameValuePair;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

/**
 * @author : wushikai
 *         <p>
 *         date : 2024-06-20
 */
public class ConnectorOfClient {


    private static Logger log = MyJulLogger.getLogger(ConnectorOfClient.class);


    public static void main(String[] args) throws Exception {
        System.getProperties().put("sun.misc.ProxyGenerator.saveGeneratedFiles", "true");   //这样会输出代理class文件
        doRequest();
    }


    private  static void doRequest( ) throws IOException {

        HttpClient httpclient = new DefaultHttpClient();
        HttpGet req = new HttpGet("http://localhost:8080/xy/expose/merDetail");

        HttpResponse response = httpclient.execute(req);  //使用 httpClient 调用 get请求
        ResponseUtil.handleResponse(response);
        httpclient.getConnectionManager().shutdown();

    }









}
